import request from "@/utils/request";
import requesta from "@/utils/requesta";

// 查询物料入库单列表
export function listItemrecpt(query) {
  return request({
    url: "/mes/wm/itemrecpt/list",
    method: "get",
    params: query,
  });
}

// 物料明细列表
export function listItem(query) {
  return request({
    url: "/mes/wm/item/list",
    method: "get",
    params: query,
  });
}

// 查询物料入库单详细
export function getItemrecpt(recptId) {
  return request({
    url: "/mes/wm/itemrecpt/" + recptId,
    method: "get",
  });
}

// 采购入库单打印
export function getItemrecptPrint(recptId) {
  return request({
    url: "/mes/wm/itemrecpt/print/" + recptId,
    method: "get",
  });
}

// 新增物料入库单
export function addItemrecpt(data) {
  return request({
    url: "/mes/wm/itemrecpt",
    method: "post",
    data: data,
  });
}

// 根据IQC检验单新增物料入库单
export function addItemrecptData(data) {
  return request({
    url: "/mes/wm/itemrecpt/addItemrecptData",
    method: "post",
    data: data,
  });
}
//打印前需要数据的接口
export function getItemRecptItems(recptId) {
  return request({
    url: "/mes/wm/itemrecpt/list/wmItemRecptItems/" + recptId,
    method: "get",
  });
}

//批量打印前需要数据的接口
export function getItemsRecpt(data) {
  return request({
    url: "/mes/wm/itemrecpt/list/wmItemRecptItemList",
    method: "post",
    data: data,
  });
}

//  打印序列号功能
export function printItem(data) {
  return requesta({
    url: "/hici/print/WmItemRecptItem",
    method: "post",
    data: data,
  });
}

//  打印批次号功能
// export function batchItem(data) {
//   return requesta({
//     url: '/hici/print/WmItemRecptItemBatchCode',
//     method: 'post',
//     data: data
//   })
// }

// 打印批次号功能
export function batchItem(data) {
  return requesta({
    url: "/hici/print/WmItemRecptBatchCodeCh",
    method: "post",
    data: data,
  });
}
// 批次号打印获取数据接口
export function wmItemRecptItemListBantch(data) {
  return request({
    url: "/mes/wm/itemrecpt/list/wmItemRecptItemListBantch",
    method: "post",
    data: data,
  });
}
//入库批次打印获取参数
export function wmItemRecptItemListBantch2(data) {
  return request({
    url: "/mes/wm/itemrecpt/print/wmItemRecptItemListBantch",
    method: "post",
    data: data,
  });
}
//打印入库批次
export function batchItem2(data) {
  return requesta({
    url: "/hici/print/wmItemRecptBachCode",
    method: "post",
    data: data,
  });
}

// 修改物料入库单
export function updateItemrecpt(data) {
  return request({
    url: "/mes/wm/itemrecpt",
    method: "put",
    data: data,
  });
}

// 确认物料入库单
export function confirmItemrecpt(data) {
  return request({
    url: "/mes/wm/itemrecpt/confirm",
    method: "put",
    data: data,
  });
}

//执行入库
export function execute(recptId) {
  return request({
    url: "/mes/wm/itemrecpt/" + recptId,
    method: "put",
  });
}

// 删除物料入库单
export function delItemrecpt(recptId) {
  return request({
    url: "/mes/wm/itemrecpt/" + recptId,
    method: "delete",
  });
}
export function editFreeze(data) {
  return request({
    url: "/mes/wm/itemrecpt/editFreeze",
    method: "put",
    data: data,
  });
}

export function saveToErp(recptId) {
  return request({
    url: "/mes/k3cloud/api/wmItemRecpt/saveToErp/" + recptId,
    method: "get",
  });
}
